<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>SQLAlchemy 0.4 Documentation - module sqlalchemy.schema</title>
	
    
    <link rel="stylesheet" href="style.css"></link>
    <link rel="stylesheet" href="docs.css"></link>
    <link href="syntaxhighlight.css" rel="stylesheet" type="text/css"></link>
    <script src="scripts.js"></script>

    <link rel="stylesheet" href="docutil.css"></link>



</head>
<body>








<div id="topanchor"><a name="top">&nbsp;</a></div>


<h1>SQLAlchemy 0.4 Documentation</h1>

<div id="pagecontrol"><a href="index.html">Multiple Pages</a> | <a href="documentation.html">One Page</a></div>

<div class="versionheader">Version: 0.4.8   Last Updated: 10/12/08 13:33:19</div>












    <div class="topnav">

    
    <div class="navbanner">
        <a href="index.html" class="totoc">Table of Contents</a>
        
    <div class="prevnext">
            Up: <a href="docstrings.html">API Documentation</a>

               |   
            Previous: <a href="sqlalchemy_pool.html">module sqlalchemy.pool</a>

               |   
            Next: <a href="sqlalchemy_sql_compiler.html">module sqlalchemy.sql.compiler</a>
    </div>

        <h2>module sqlalchemy.schema</h2>
    </div>

	
	
    <ul>
        
        <li><a style="" href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_CheckConstraint">class CheckConstraint(Constraint)</a></li>

        
        <li><a style="" href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_Column">class Column(SchemaItem,_ColumnClause)</a></li>

        
        <li><a style="" href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_ColumnDefault">class ColumnDefault(DefaultGenerator)</a></li>

        
        <li><a style="" href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_Constraint">class Constraint(SchemaItem)</a></li>

        
        <li><a style="" href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_DDL">class DDL(object)</a></li>

        
        <li><a style="" href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_DefaultGenerator">class DefaultGenerator(SchemaItem)</a></li>

        
        <li><a style="" href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_ForeignKey">class ForeignKey(SchemaItem)</a></li>

        
        <li><a style="" href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_ForeignKeyConstraint">class ForeignKeyConstraint(Constraint)</a></li>

        
        <li><a style="" href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_Index">class Index(SchemaItem)</a></li>

        
        <li><a style="" href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_MetaData">class MetaData(SchemaItem)</a></li>

        
        <li><a style="" href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_PassiveDefault">class PassiveDefault(DefaultGenerator)</a></li>

        
        <li><a style="" href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_PrimaryKeyConstraint">class PrimaryKeyConstraint(Constraint)</a></li>

        
        <li><a style="" href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_SchemaItem">class SchemaItem(object)</a></li>

        
        <li><a style="" href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_SchemaVisitor">class SchemaVisitor(ClauseVisitor)</a></li>

        
        <li><a style="" href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_Sequence">class Sequence(DefaultGenerator)</a></li>

        
        <li><a style="" href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_Table">class Table(SchemaItem,TableClause)</a></li>

        
        <li><a style="" href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_ThreadLocalMetaData">class ThreadLocalMetaData(MetaData)</a></li>

        
        <li><a style="" href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_UniqueConstraint">class UniqueConstraint(Constraint)</a></li>

    </ul>

	</div>



    

    
    
    <A name="docstrings_sqlalchemy.schema"></a>
    
    <div class="sectionL2">

    <h3>module sqlalchemy.schema</h3>
    
    
    <div class="darkcell"><p>The schema module provides the building blocks for database metadata.</p>
<p>Each element within this module describes a database entity which can be
created and dropped, or is otherwise part of such an entity.  Examples include
tables, columns, sequences, and indexes.</p>
<p>All entities are subclasses of <a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_SchemaItem">SchemaItem</a>, and as defined
in this module they are intended to be agnostic of any vendor-specific
constructs.</p>
<p>A collection of entities are grouped into a unit called
<a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_MetaData">MetaData</a>.  MetaData serves as a logical grouping of schema
elements, and can also be associated with an actual database connection such
that operations involving the contained elements can contact the database as
needed.</p>
<p>Two of the elements here also build upon their &quot;syntactic&quot; counterparts, which
are defined in <a href="sqlalchemy_sql_expression.html#docstrings_sqlalchemy.sql.expression">module sqlalchemy.sql.expression</a>, specifically
<a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_Table">Table</a> and <a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_Column">Column</a>.  Since these objects
are part of the SQL expression language, they are usable as components in SQL
expressions.</p>
</div>
    


            
    

    
    
    <A name="docstrings_sqlalchemy.schema_CheckConstraint"></a>
    
    <div class="sectionL3">

    <h3>class CheckConstraint(<a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_Constraint">Constraint</a>)</h3>
    
    
    <div class="darkcell"><p>A table- or column-level CHECK constraint.</p>
<p>Can be included in the definition of a Table or Column.</p>
</div>
    

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __init__(<i>self</i>, <i>sqltext</i>, <i>name=None</i>, <i>deferrable=None</i>, <i>initially=None</i>)</b>
    <div class="docstring">
    <p>Construct a CHECK constraint.</p>
<dl class="docutils">
<dt>sqltext</dt>
<dd>A string containing the constraint definition.  Will be used
verbatim.</dd>
<dt>name</dt>
<dd>Optional, the in-database name of the constraint.</dd>
<dt>deferrable</dt>
<dd>Optional bool.  If set, emit DEFERRABLE or NOT DEFERRABLE when
issuing DDL for this constraint.</dd>
<dt>initially</dt>
<dd>Optional string.  If set, emit INITIALLY &lt;value&gt; when issuing DDL
for this constraint.</dd>
</dl>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def copy(<i>self</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
         <div class="darkcell">
         <A name=""></a>
         <b>__visit_name__ = property()</b>
         <div class="docstring">
         
         </div> 
         </div>


    

            <a href="#top" class="totoc">back to section top</a>
    </div>



            
    

    
    
    <A name="docstrings_sqlalchemy.schema_Column"></a>
    
    <div class="sectionL3">

    <h3>class Column(<a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_SchemaItem">SchemaItem</a>,<a href="sqlalchemy_sql_expression.html#docstrings_sqlalchemy.sql.expression__ColumnClause">_ColumnClause</a>)</h3>
    
    
    <div class="darkcell"><p>Represent a column in a database table.</p>
<p>This is a subclass of <tt class="docutils literal"><span class="pre">expression.ColumnClause</span></tt> and represents an actual
existing table in the database, in a similar fashion as
<tt class="docutils literal"><span class="pre">TableClause</span></tt>/<tt class="docutils literal"><span class="pre">Table</span></tt>.</p>
</div>
    

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __init__(<i>self</i>, <i>*args</i>, <i>**kwargs</i>)</b>
    <div class="docstring">
    <p>Construct a new <tt class="docutils literal"><span class="pre">Column</span></tt> object.</p>
<p>Arguments are:</p>
<dl class="docutils">
<dt>name</dt>
<dd>The name of this column.  This should be the identical name as it
appears, or will appear, in the database.  Name may be omitted at
construction time but must be assigned before adding a Column
instance to a Table.</dd>
<dt>type_</dt>
<dd>The <tt class="docutils literal"><span class="pre">TypeEngine</span></tt> for this column.  This can be any subclass of
<tt class="docutils literal"><span class="pre">types.AbstractType</span></tt>, including the database-agnostic types
defined in the types module, database-specific types defined within
specific database modules, or user-defined types. If the column
contains a ForeignKey, the type can also be None, in which case the
type assigned will be that of the referenced column.</dd>
<dt>*args</dt>
<dd>Constraint, ForeignKey, ColumnDefault and Sequence objects should be
added as list values.</dd>
<dt>**kwargs</dt>
<dd><p class="first">Keyword arguments include:</p>
<dl class="last docutils">
<dt>key</dt>
<dd><p class="first">Defaults to the column name: a Python-only <em>alias name</em> for this
column.</p>
<p class="last">The column will then be identified everywhere in an application,
including the column list on its Table, by this key, and not the
given name.  Generated SQL, however, will still reference the
column by its actual name.</p>
</dd>
<dt>primary_key</dt>
<dd>Defaults to False: True if this column is a primary key column.
Multiple columns can have this flag set to specify composite
primary keys.  As an alternative, the primary key of a Table can
be specified via an explicit <tt class="docutils literal"><span class="pre">PrimaryKeyConstraint</span></tt> instance
appended to the Table's list of objects.</dd>
<dt>nullable</dt>
<dd>Defaults to True : True if this column should allow nulls. True is
the default unless this column is a primary key column.</dd>
<dt>default</dt>
<dd>Defaults to None: a scalar, Python callable, or <tt class="docutils literal"><span class="pre">ClauseElement</span></tt>
representing the <em>default value</em> for this column, which will be
invoked upon insert if this column is not present in the insert
list or is given a value of None.  The default expression will be
converted into a <tt class="docutils literal"><span class="pre">ColumnDefault</span></tt> object upon initialization.</dd>
<dt>_is_oid</dt>
<dd>Defaults to False: used internally to indicate that this column is
used as the quasi-hidden &quot;oid&quot; column</dd>
<dt>index</dt>
<dd>Defaults to False: indicates that this column is indexed. The name
of the index is autogenerated.  to specify indexes with explicit
names or indexes that contain multiple columns, use the <tt class="docutils literal"><span class="pre">Index</span></tt>
construct instead.</dd>
<dt>info</dt>
<dd>Defaults to {}: A space to store application specific data; this
must be a dictionary.</dd>
<dt>unique</dt>
<dd>Defaults to False: indicates that this column contains a unique
constraint, or if <cite>index</cite> is True as well, indicates that the
Index should be created with the unique flag.  To specify multiple
columns in the constraint/index or to specify an explicit name,
use the <tt class="docutils literal"><span class="pre">UniqueConstraint</span></tt> or <tt class="docutils literal"><span class="pre">Index</span></tt> constructs instead.</dd>
<dt>autoincrement</dt>
<dd>Defaults to True: indicates that integer-based primary key columns
should have autoincrementing behavior, if supported by the
underlying database.  This will affect <tt class="docutils literal"><span class="pre">CREATE</span> <span class="pre">TABLE</span></tt> statements
such that they will use the databases <em>auto-incrementing</em> keyword
(such as <tt class="docutils literal"><span class="pre">SERIAL</span></tt> for Postgres, <tt class="docutils literal"><span class="pre">AUTO_INCREMENT</span></tt> for Mysql)
and will also affect the behavior of some dialects during
<tt class="docutils literal"><span class="pre">INSERT</span></tt> statement execution such that they will assume primary
key values are created in this manner.  If a <tt class="docutils literal"><span class="pre">Column</span></tt> has an
explicit <tt class="docutils literal"><span class="pre">ColumnDefault</span></tt> object (such as via the <cite>default</cite>
keyword, or a <tt class="docutils literal"><span class="pre">Sequence</span></tt> or <tt class="docutils literal"><span class="pre">PassiveDefault</span></tt>), then the value
of <cite>autoincrement</cite> is ignored and is assumed to be False.
<cite>autoincrement</cite> value is only significant for a column with a type
or subtype of Integer.</dd>
<dt>quote</dt>
<dd>When True, indicates that the Column identifier must be quoted.
This flag does <em>not</em> disable quoting; for case-insensitive names,
use an all lower case identifier.</dd>
</dl>
</dd>
</dl>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def append_foreign_key(<i>self</i>, <i>fk</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
         <div class="darkcell">
         <A name=""></a>
         <b>bind = property()</b>
         <div class="docstring">
         
         </div> 
         </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def copy(<i>self</i>)</b>
    <div class="docstring">
    <p>Create a copy of this <tt class="docutils literal"><span class="pre">Column</span></tt>, unitialized.</p>
<p>This is used in <tt class="docutils literal"><span class="pre">Table.tometadata</span></tt>.</p>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def get_children(<i>self</i>, <i>schema_visitor=False</i>, <i>**kwargs</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def references(<i>self</i>, <i>column</i>)</b>
    <div class="docstring">
    <p>Return True if this references the given column via a foreign key.</p>

    </div>
    </div>


    

            <a href="#top" class="totoc">back to section top</a>
    </div>



            
    

    
    
    <A name="docstrings_sqlalchemy.schema_ColumnDefault"></a>
    
    <div class="sectionL3">

    <h3>class ColumnDefault(<a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_DefaultGenerator">DefaultGenerator</a>)</h3>
    
    
    <div class="darkcell"><p>A plain default value on a column.</p>
<p>This could correspond to a constant, a callable function, or a SQL clause.</p>
</div>
    

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __init__(<i>self</i>, <i>arg</i>, <i>**kwargs</i>)</b>
    <div class="docstring">
    <p>Construct a new <tt class="docutils literal"><span class="pre">ColumnDefault</span></tt>.</p>

    </div>
    </div>

                    
         <div class="darkcell">
         <A name=""></a>
         <b>__visit_name__ = property()</b>
         <div class="docstring">
         
         </div> 
         </div>


    

            <a href="#top" class="totoc">back to section top</a>
    </div>



            
    

    
    
    <A name="docstrings_sqlalchemy.schema_Constraint"></a>
    
    <div class="sectionL3">

    <h3>class Constraint(<a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_SchemaItem">SchemaItem</a>)</h3>
    
    
    <div class="darkcell"><p>A table-level SQL constraint, such as a KEY.</p>
<p>Implements a hybrid of dict/setlike behavior with regards to the list of
underying columns.</p>
</div>
    

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __init__(<i>self</i>, <i>name=None</i>, <i>deferrable=None</i>, <i>initially=None</i>)</b>
    <div class="docstring">
    <p>Create a SQL constraint.</p>
<dl class="docutils">
<dt>name</dt>
<dd>Optional, the in-database name of this <tt class="docutils literal"><span class="pre">Constraint</span></tt>.</dd>
<dt>deferrable</dt>
<dd>Optional bool.  If set, emit DEFERRABLE or NOT DEFERRABLE when
issuing DDL for this constraint.</dd>
<dt>initially</dt>
<dd>Optional string.  If set, emit INITIALLY &lt;value&gt; when issuing DDL
for this constraint.</dd>
</dl>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def copy(<i>self</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def keys(<i>self</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __add__(<i>self</i>, <i>other</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __contains__(<i>self</i>, <i>x</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __iter__(<i>self</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __len__(<i>self</i>)</b>
    <div class="docstring">
    
    </div>
    </div>


    

            <a href="#top" class="totoc">back to section top</a>
    </div>



            
    

    
    
    <A name="docstrings_sqlalchemy.schema_DDL"></a>
    
    <div class="sectionL3">

    <h3>class DDL(object)</h3>
    
    
    <div class="darkcell"><p>A literal DDL statement.</p>
<p>Specifies literal SQL DDL to be executed by the database.  DDL objects can
be attached to <tt class="docutils literal"><span class="pre">Tables</span></tt> or <tt class="docutils literal"><span class="pre">MetaData</span></tt> instances, conditionally
executing SQL as part of the DDL lifecycle of those schema items.  Basic
templating support allows a single DDL instance to handle repetitive tasks
for multiple tables.</p>
<p>Examples:</p>
<pre class="literal-block">
tbl = Table('users', metadata, Column('uid', Integer)) # ...
DDL('DROP TRIGGER users_trigger').execute_at('before-create', tbl)

spow = DDL('ALTER TABLE %(table)s SET secretpowers TRUE', on='somedb')
spow.execute_at('after-create', tbl)

drop_spow = DDL('ALTER TABLE users SET secretpowers FALSE')
connection.execute(drop_spow)
</pre>
</div>
    

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __init__(<i>self</i>, <i>statement</i>, <i>on=None</i>, <i>context=None</i>, <i>bind=None</i>)</b>
    <div class="docstring">
    <p>Create a DDL statement.</p>
<dl class="docutils">
<dt>statement</dt>
<dd><p class="first">A string or unicode string to be executed.  Statements will be
processed with Python's string formatting operator.  See the
<tt class="docutils literal"><span class="pre">context</span></tt> argument and the <tt class="docutils literal"><span class="pre">execute_at</span></tt> method.</p>
<p>A literal '%' in a statement must be escaped as '%%'.</p>
<p class="last">SQL bind parameters are not available in DDL statements.</p>
</dd>
<dt>on</dt>
<dd><p class="first">Optional filtering criteria.  May be a string or a callable
predicate.  If a string, it will be compared to the name of the
executing database dialect:</p>
<pre class="literal-block">
DDL('something', on='postgres')
</pre>
<p>If a callable, it will be invoked with three positional arguments:</p>
<blockquote>
<dl class="docutils">
<dt>event</dt>
<dd>The name of the event that has triggered this DDL, such as
'after-create' Will be None if the DDL is executed explicitly.</dd>
<dt>schema_item</dt>
<dd>A SchemaItem instance, such as <tt class="docutils literal"><span class="pre">Table</span></tt> or <tt class="docutils literal"><span class="pre">MetaData</span></tt>. May be
None if the DDL is executed explicitly.</dd>
<dt>connection</dt>
<dd>The <tt class="docutils literal"><span class="pre">Connection</span></tt> being used for DDL execution</dd>
</dl>
</blockquote>
<p class="last">If the callable returns a true value, the DDL statement will be
executed.</p>
</dd>
<dt>context</dt>
<dd>Optional dictionary, defaults to None.  These values will be
available for use in string substitutions on the DDL statement.</dd>
<dt>bind</dt>
<dd>Optional. A <tt class="docutils literal"><span class="pre">Connectable</span></tt>, used by default when <tt class="docutils literal"><span class="pre">execute()</span></tt>
is invoked without a bind argument.</dd>
</dl>

    </div>
    </div>

                    
         <div class="darkcell">
         <A name=""></a>
         <b>bind = property()</b>
         <div class="docstring">
         <p>An Engine or Connection to which this DDL is bound.</p>
<p>This property may be assigned an <tt class="docutils literal"><span class="pre">Engine</span></tt> or <tt class="docutils literal"><span class="pre">Connection</span></tt>, or
assigned a string or URL to automatically create a basic <tt class="docutils literal"><span class="pre">Engine</span></tt>
for this bind with <tt class="docutils literal"><span class="pre">create_engine()</span></tt>.</p>

         </div> 
         </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def execute(<i>self</i>, <i>bind=None</i>, <i>schema_item=None</i>)</b>
    <div class="docstring">
    <p>Execute this DDL immediately.</p>
<p>Executes the DDL statement in isolation using the supplied
<tt class="docutils literal"><span class="pre">Connectable</span></tt> or <tt class="docutils literal"><span class="pre">Connectable</span></tt> assigned to the <tt class="docutils literal"><span class="pre">.bind</span></tt> property,
if not supplied.  If the DDL has a conditional <tt class="docutils literal"><span class="pre">on</span></tt> criteria, it
will be invoked with None as the event.</p>
<dl class="docutils">
<dt>bind</dt>
<dd>Optional, an <tt class="docutils literal"><span class="pre">Engine</span></tt> or <tt class="docutils literal"><span class="pre">Connection</span></tt>.  If not supplied, a
valid <tt class="docutils literal"><span class="pre">Connectable</span></tt> must be present in the <tt class="docutils literal"><span class="pre">.bind</span></tt> property.</dd>
<dt>schema_item</dt>
<dd>Optional, defaults to None.  Will be passed to the <tt class="docutils literal"><span class="pre">on</span></tt> callable
criteria, if any, and may provide string expansion data for the
statement. See <tt class="docutils literal"><span class="pre">execute_at</span></tt> for more information.</dd>
</dl>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def execute_at(<i>self</i>, <i>event</i>, <i>schema_item</i>)</b>
    <div class="docstring">
    <p>Link execution of this DDL to the DDL lifecycle of a SchemaItem.</p>
<p>Links this <tt class="docutils literal"><span class="pre">DDL</span></tt> to a <tt class="docutils literal"><span class="pre">Table</span></tt> or <tt class="docutils literal"><span class="pre">MetaData</span></tt> instance, executing
it when that schema item is created or dropped.  The DDL statement
will be executed using the same Connection and transactional context
as the Table create/drop itself.  The <tt class="docutils literal"><span class="pre">.bind</span></tt> property of this
statement is ignored.</p>
<dl class="docutils">
<dt>event</dt>
<dd>One of the events defined in the schema item's <tt class="docutils literal"><span class="pre">.ddl_events</span></tt>;
e.g. 'before-create', 'after-create', 'before-drop' or 'after-drop'</dd>
<dt>schema_item</dt>
<dd>A Table or MetaData instance</dd>
</dl>
<p>When operating on Table events, the following additional <tt class="docutils literal"><span class="pre">statement</span></tt>
string substitions are available:</p>
<pre class="literal-block">
%(table)s  - the Table name, with any required quoting applied
%(schema)s - the schema name, with any required quoting applied
%(fullname)s - the Table name including schema, quoted if needed
</pre>
<p>The DDL's <tt class="docutils literal"><span class="pre">context</span></tt>, if any, will be combined with the standard
substutions noted above.  Keys present in the context will override
the standard substitutions.</p>
<p>A DDL instance can be linked to any number of schema items. The
statement subsitution support allows for DDL instances to be used in a
template fashion.</p>
<p><tt class="docutils literal"><span class="pre">execute_at</span></tt> builds on the <tt class="docutils literal"><span class="pre">append_ddl_listener</span></tt> interface of
MetaDta and Table objects.</p>
<p>Caveat: Creating or dropping a Table in isolation will also trigger
any DDL set to <tt class="docutils literal"><span class="pre">execute_at</span></tt> that Table's MetaData.  This may change
in a future release.</p>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __call__(<i>self</i>, <i>event</i>, <i>schema_item</i>, <i>bind</i>)</b>
    <div class="docstring">
    <p>Execute the DDL as a ddl_listener.</p>

    </div>
    </div>


    

            <a href="#top" class="totoc">back to section top</a>
    </div>



            
    

    
    
    <A name="docstrings_sqlalchemy.schema_DefaultGenerator"></a>
    
    <div class="sectionL3">

    <h3>class DefaultGenerator(<a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_SchemaItem">SchemaItem</a>)</h3>
    
    
    <div class="darkcell"><p>Base class for column <em>default</em> values.</p>
</div>
    

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __init__(<i>self</i>, <i>for_update=False</i>, <i>metadata=None</i>)</b>
    <div class="docstring">
    <p>Construct a new <tt class="docutils literal"><span class="pre">DefaultGenerator</span></tt>.</p>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def execute(<i>self</i>, <i>bind=None</i>, <i>**kwargs</i>)</b>
    <div class="docstring">
    
    </div>
    </div>


    

            <a href="#top" class="totoc">back to section top</a>
    </div>



            
    

    
    
    <A name="docstrings_sqlalchemy.schema_ForeignKey"></a>
    
    <div class="sectionL3">

    <h3>class ForeignKey(<a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_SchemaItem">SchemaItem</a>)</h3>
    
    
    <div class="darkcell"><p>Defines a column-level FOREIGN KEY constraint between two columns.</p>
<p><tt class="docutils literal"><span class="pre">ForeignKey</span></tt> is specified as an argument to a <tt class="docutils literal"><span class="pre">Column</span></tt> object.</p>
<p>For a composite (multiple column) FOREIGN KEY, use a ForeignKeyConstraint
within the Table definition.</p>
</div>
    

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __init__(<i>self</i>, <i>column</i>, <i>constraint=None</i>, <i>use_alter=False</i>, <i>name=None</i>, <i>onupdate=None</i>, <i>ondelete=None</i>, <i>deferrable=None</i>, <i>initially=None</i>)</b>
    <div class="docstring">
    <p>Construct a column-level FOREIGN KEY.</p>
<dl class="docutils">
<dt>column</dt>
<dd>A single target column for the key relationship.  A <tt class="docutils literal"><span class="pre">Column</span></tt>
object or a column name as a string: <tt class="docutils literal"><span class="pre">tablename.columnname</span></tt> or
<tt class="docutils literal"><span class="pre">schema.tablename.columnname</span></tt>.</dd>
<dt>constraint</dt>
<dd>Optional.  A parent <tt class="docutils literal"><span class="pre">ForeignKeyConstraint</span></tt> object.  If not
supplied, a <tt class="docutils literal"><span class="pre">ForeignKeyConstraint</span></tt> will be automatically created
and added to the parent table.</dd>
<dt>name</dt>
<dd>Optional string.  An in-database name for the key if <cite>constraint</cite> is
not provided.</dd>
<dt>onupdate</dt>
<dd>Optional string.  If set, emit ON UPDATE &lt;value&gt; when issuing DDL
for this constraint.  Typical values include CASCADE, DELETE and
RESTRICT.</dd>
<dt>ondelete</dt>
<dd>Optional string.  If set, emit ON DELETE &lt;value&gt; when issuing DDL
for this constraint.  Typical values include CASCADE, DELETE and
RESTRICT.</dd>
<dt>deferrable</dt>
<dd>Optional bool.  If set, emit DEFERRABLE or NOT DEFERRABLE when
issuing DDL for this constraint.</dd>
<dt>initially</dt>
<dd>Optional string.  If set, emit INITIALLY &lt;value&gt; when issuing DDL
for this constraint.</dd>
<dt>use_alter</dt>
<dd>If True, do not emit this key as part of the CREATE TABLE
definition.  Instead, use ALTER TABLE after table creation to add
the key.  Useful for circular dependencies.</dd>
</dl>

    </div>
    </div>

                    
         <div class="darkcell">
         <A name=""></a>
         <b>column = property()</b>
         <div class="docstring">
         
         </div> 
         </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def copy(<i>self</i>)</b>
    <div class="docstring">
    <p>Produce a copy of this ForeignKey object.</p>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def get_referent(<i>self</i>, <i>table</i>)</b>
    <div class="docstring">
    <p>Return the column in the given table referenced by this ForeignKey.</p>
<p>Returns None if this <tt class="docutils literal"><span class="pre">ForeignKey</span></tt> does not reference the given table.</p>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def references(<i>self</i>, <i>table</i>)</b>
    <div class="docstring">
    <p>Return True if the given table is referenced by this ForeignKey.</p>

    </div>
    </div>

                    
         <div class="darkcell">
         <A name=""></a>
         <b>target_fullname = property()</b>
         <div class="docstring">
         
         </div> 
         </div>


    

            <a href="#top" class="totoc">back to section top</a>
    </div>



            
    

    
    
    <A name="docstrings_sqlalchemy.schema_ForeignKeyConstraint"></a>
    
    <div class="sectionL3">

    <h3>class ForeignKeyConstraint(<a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_Constraint">Constraint</a>)</h3>
    
    
    <div class="darkcell"><p>A table-level FOREIGN KEY constraint.</p>
<p>Defines a single column or composite FOREIGN KEY ... REFERENCES
constraint. For a no-frills, single column foreign key, adding a
<tt class="docutils literal"><span class="pre">ForeignKey</span></tt> to the definition of a <tt class="docutils literal"><span class="pre">Column</span></tt> is a shorthand equivalent
for an unnamed, single column <tt class="docutils literal"><span class="pre">ForeignKeyConstraint</span></tt>.</p>
</div>
    

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __init__(<i>self</i>, <i>columns</i>, <i>refcolumns</i>, <i>name=None</i>, <i>onupdate=None</i>, <i>ondelete=None</i>, <i>use_alter=False</i>, <i>deferrable=None</i>, <i>initially=None</i>)</b>
    <div class="docstring">
    <p>Construct a composite-capable FOREIGN KEY.</p>
<dl class="docutils">
<dt>columns</dt>
<dd>A sequence of local column names.  The named columns must be defined
and present in the parent Table.</dd>
<dt>refcolumns</dt>
<dd>A sequence of foreign column names or Column objects.  The columns
must all be located within the same Table.</dd>
<dt>name</dt>
<dd>Optional, the in-database name of the key.</dd>
<dt>onupdate</dt>
<dd>Optional string.  If set, emit ON UPDATE &lt;value&gt; when issuing DDL
for this constraint.  Typical values include CASCADE, DELETE and
RESTRICT.</dd>
<dt>ondelete</dt>
<dd>Optional string.  If set, emit ON DELETE &lt;value&gt; when issuing DDL
for this constraint.  Typical values include CASCADE, DELETE and
RESTRICT.</dd>
<dt>deferrable</dt>
<dd>Optional bool.  If set, emit DEFERRABLE or NOT DEFERRABLE when
issuing DDL for this constraint.</dd>
<dt>initially</dt>
<dd>Optional string.  If set, emit INITIALLY &lt;value&gt; when issuing DDL
for this constraint.</dd>
<dt>use_alter</dt>
<dd>If True, do not emit this key as part of the CREATE TABLE
definition.  Instead, use ALTER TABLE after table creation to add
the key.  Useful for circular dependencies.</dd>
</dl>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def append_element(<i>self</i>, <i>col</i>, <i>refcol</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def copy(<i>self</i>)</b>
    <div class="docstring">
    
    </div>
    </div>


    

            <a href="#top" class="totoc">back to section top</a>
    </div>



            
    

    
    
    <A name="docstrings_sqlalchemy.schema_Index"></a>
    
    <div class="sectionL3">

    <h3>class Index(<a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_SchemaItem">SchemaItem</a>)</h3>
    
    
    <div class="darkcell"><p>A table-level INDEX.</p>
<p>Defines a composite (one or more column) INDEX. For a no-frills, single
column index, adding <tt class="docutils literal"><span class="pre">index=True</span></tt> to the <tt class="docutils literal"><span class="pre">Column</span></tt> definition is
a shorthand equivalent for an unnamed, single column Index.</p>
</div>
    

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __init__(<i>self</i>, <i>name</i>, <i>*columns</i>, <i>**kwargs</i>)</b>
    <div class="docstring">
    <p>Construct an index object.</p>
<p>Arguments are:</p>
<dl class="docutils">
<dt>name</dt>
<dd>The name of the index</dd>
<dt>*columns</dt>
<dd>Columns to include in the index. All columns must belong to the same
table, and no column may appear more than once.</dd>
<dt>**kwargs</dt>
<dd><p class="first">Keyword arguments include:</p>
<dl class="last docutils">
<dt>unique</dt>
<dd>Defaults to False: create a unique index.</dd>
<dt>postgres_where</dt>
<dd>Defaults to None: create a partial index when using PostgreSQL</dd>
</dl>
</dd>
</dl>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def append_column(<i>self</i>, <i>column</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def create(<i>self</i>, <i>bind=None</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def drop(<i>self</i>, <i>bind=None</i>)</b>
    <div class="docstring">
    
    </div>
    </div>


    

            <a href="#top" class="totoc">back to section top</a>
    </div>



            
    

    
    
    <A name="docstrings_sqlalchemy.schema_MetaData"></a>
    
    <div class="sectionL3">

    <h3>class MetaData(<a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_SchemaItem">SchemaItem</a>)</h3>
    
    
    <div class="darkcell"><p>A collection of Tables and their associated schema constructs.</p>
<p>Holds a collection of Tables and an optional binding to an <tt class="docutils literal"><span class="pre">Engine</span></tt> or
<tt class="docutils literal"><span class="pre">Connection</span></tt>.  If bound, the <a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_Table">Table</a> objects in the
collection and their columns may participate in implicit SQL execution.</p>
<p>The <tt class="docutils literal"><span class="pre">bind</span></tt> property may be assigned to dynamically.  A common pattern is
to start unbound and then bind later when an engine is available:</p>
<pre class="literal-block">
metadata = MetaData()
# define tables
Table('mytable', metadata, ...)
# connect to an engine later, perhaps after loading a URL from a
# configuration file
metadata.bind = an_engine
</pre>
<p>MetaData is a thread-safe object after tables have been explicitly defined
or loaded via reflection.</p>
</div>
    

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __init__(<i>self</i>, <i>bind=None</i>, <i>reflect=False</i>)</b>
    <div class="docstring">
    <p>Create a new MetaData object.</p>
<dl class="docutils">
<dt>bind</dt>
<dd>An Engine or Connection to bind to.  May also be a string or URL
instance, these are passed to create_engine() and this MetaData will
be bound to the resulting engine.</dd>
<dt>reflect</dt>
<dd>Optional, automatically load all tables from the bound database.
Defaults to False. <tt class="docutils literal"><span class="pre">bind</span></tt> is required when this option is set.
For finer control over loaded tables, use the <tt class="docutils literal"><span class="pre">reflect</span></tt> method of
<tt class="docutils literal"><span class="pre">MetaData</span></tt>.</dd>
</dl>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def append_ddl_listener(<i>self</i>, <i>event</i>, <i>listener</i>)</b>
    <div class="docstring">
    <p>Append a DDL event listener to this <tt class="docutils literal"><span class="pre">MetaData</span></tt>.</p>
<p>The <tt class="docutils literal"><span class="pre">listener</span></tt> callable will be triggered when this <tt class="docutils literal"><span class="pre">MetaData</span></tt> is
involved in DDL creates or drops, and will be invoked either before
all Table-related actions or after.</p>
<p>Arguments are:</p>
<dl class="docutils">
<dt>event</dt>
<dd>One of <tt class="docutils literal"><span class="pre">MetaData.ddl_events</span></tt>; 'before-create', 'after-create',
'before-drop' or 'after-drop'.</dd>
<dt>listener</dt>
<dd><p class="first">A callable, invoked with three positional arguments:</p>
<dl class="last docutils">
<dt>event</dt>
<dd>The event currently being handled</dd>
<dt>schema_item</dt>
<dd>The <tt class="docutils literal"><span class="pre">MetaData</span></tt> object being operated upon</dd>
<dt>bind</dt>
<dd>The <tt class="docutils literal"><span class="pre">Connection</span></tt> bueing used for DDL execution.</dd>
</dl>
</dd>
</dl>
<p>Listeners are added to the MetaData's <tt class="docutils literal"><span class="pre">ddl_listeners</span></tt> attribute.</p>
<p>Note: MetaData listeners are invoked even when <tt class="docutils literal"><span class="pre">Tables</span></tt> are created
in isolation.  This may change in a future release. I.e.:</p>
<pre class="literal-block">
# triggers all MetaData and Table listeners:
metadata.create_all()

# triggers MetaData listeners too:
some.table.create()
</pre>

    </div>
    </div>

                    
         <div class="darkcell">
         <A name=""></a>
         <b>bind = property()</b>
         <div class="docstring">
         <p>An Engine or Connection to which this MetaData is bound.</p>
<p>This property may be assigned an <tt class="docutils literal"><span class="pre">Engine</span></tt> or <tt class="docutils literal"><span class="pre">Connection</span></tt>, or
assigned a string or URL to automatically create a basic <tt class="docutils literal"><span class="pre">Engine</span></tt>
for this bind with <tt class="docutils literal"><span class="pre">create_engine()</span></tt>.</p>

         </div> 
         </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def clear(<i>self</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def connect(<i>*args</i>, <i>**kwargs</i>)</b>
    <div class="docstring">
    <p>Deprecated.
Bind this MetaData to an Engine.</p>
<blockquote>
<p>Use <tt class="docutils literal"><span class="pre">metadata.bind</span> <span class="pre">=</span> <span class="pre">&lt;engine&gt;</span></tt> or <tt class="docutils literal"><span class="pre">metadata.bind</span> <span class="pre">=</span> <span class="pre">&lt;url&gt;</span></tt>.</p>
<dl class="docutils">
<dt>bind</dt>
<dd>A string, <tt class="docutils literal"><span class="pre">URL</span></tt>, <tt class="docutils literal"><span class="pre">Engine</span></tt> or <tt class="docutils literal"><span class="pre">Connection</span></tt> instance.  If a
string or <tt class="docutils literal"><span class="pre">URL</span></tt>, will be passed to <tt class="docutils literal"><span class="pre">create_engine()</span></tt> along with
<tt class="docutils literal"><span class="pre">\**kwargs</span></tt> to produce the engine which to connect to.  Otherwise
connects directly to the given <tt class="docutils literal"><span class="pre">Engine</span></tt>.</dd>
</dl>
</blockquote>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def create_all(<i>self</i>, <i>bind=None</i>, <i>tables=None</i>, <i>checkfirst=True</i>)</b>
    <div class="docstring">
    <p>Create all tables stored in this metadata.</p>
<p>Conditional by default, will not attempt to recreate tables already
present in the target database.</p>
<dl class="docutils">
<dt>bind</dt>
<dd>A <tt class="docutils literal"><span class="pre">Connectable</span></tt> used to access the database; if None, uses the
existing bind on this <tt class="docutils literal"><span class="pre">MetaData</span></tt>, if any.</dd>
<dt>tables</dt>
<dd>Optional list of <tt class="docutils literal"><span class="pre">Table</span></tt> objects, which is a subset of the total
tables in the <tt class="docutils literal"><span class="pre">MetaData</span></tt> (others are ignored).</dd>
<dt>checkfirst</dt>
<dd>Defaults to True, don't issue CREATEs for tables already present
in the target database.</dd>
</dl>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def drop_all(<i>self</i>, <i>bind=None</i>, <i>tables=None</i>, <i>checkfirst=True</i>)</b>
    <div class="docstring">
    <p>Drop all tables stored in this metadata.</p>
<p>Conditional by default, will not attempt to drop tables not present in
the target database.</p>
<dl class="docutils">
<dt>bind</dt>
<dd>A <tt class="docutils literal"><span class="pre">Connectable</span></tt> used to access the database; if None, uses
the existing bind on this <tt class="docutils literal"><span class="pre">MetaData</span></tt>, if any.</dd>
<dt>tables</dt>
<dd>Optional list of <tt class="docutils literal"><span class="pre">Table</span></tt> objects, which is a subset of the
total tables in the <tt class="docutils literal"><span class="pre">MetaData</span></tt> (others are ignored).</dd>
<dt>checkfirst</dt>
<dd>Defaults to True, don't issue CREATEs for tables already present
in the target database.</dd>
</dl>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def is_bound(<i>self</i>)</b>
    <div class="docstring">
    <p>True if this MetaData is bound to an Engine or Connection.</p>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def reflect(<i>self</i>, <i>bind=None</i>, <i>schema=None</i>, <i>only=None</i>)</b>
    <div class="docstring">
    <p>Load all available table definitions from the database.</p>
<p>Automatically creates <tt class="docutils literal"><span class="pre">Table</span></tt> entries in this <tt class="docutils literal"><span class="pre">MetaData</span></tt> for any
table available in the database but not yet present in the
<tt class="docutils literal"><span class="pre">MetaData</span></tt>.  May be called multiple times to pick up tables recently
added to the database, however no special action is taken if a table
in this <tt class="docutils literal"><span class="pre">MetaData</span></tt> no longer exists in the database.</p>
<dl class="docutils">
<dt>bind</dt>
<dd>A <tt class="docutils literal"><span class="pre">Connectable</span></tt> used to access the database; if None, uses the
existing bind on this <tt class="docutils literal"><span class="pre">MetaData</span></tt>, if any.</dd>
<dt>schema</dt>
<dd>Optional, query and reflect tables from an alterate schema.</dd>
<dt>only</dt>
<dd><p class="first">Optional.  Load only a sub-set of available named tables.  May be
specified as a sequence of names or a callable.</p>
<p>If a sequence of names is provided, only those tables will be
reflected.  An error is raised if a table is requested but not
available.  Named tables already present in this <tt class="docutils literal"><span class="pre">MetaData</span></tt> are
ignored.</p>
<p class="last">If a callable is provided, it will be used as a boolean predicate to
filter the list of potential table names.  The callable is called
with a table name and this <tt class="docutils literal"><span class="pre">MetaData</span></tt> instance as positional
arguments and should return a true value for any table to reflect.</p>
</dd>
</dl>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def remove(<i>self</i>, <i>table</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def table_iterator(<i>self</i>, <i>reverse=True</i>, <i>tables=None</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __contains__(<i>self</i>, <i>key</i>)</b>
    <div class="docstring">
    
    </div>
    </div>


    

            <a href="#top" class="totoc">back to section top</a>
    </div>



            
    

    
    
    <A name="docstrings_sqlalchemy.schema_PassiveDefault"></a>
    
    <div class="sectionL3">

    <h3>class PassiveDefault(<a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_DefaultGenerator">DefaultGenerator</a>)</h3>
    
    
    <div class="darkcell"><p>A default that takes effect on the database side.</p>
</div>
    

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __init__(<i>self</i>, <i>arg</i>, <i>**kwargs</i>)</b>
    <div class="docstring">
    <p>Construct a new <tt class="docutils literal"><span class="pre">PassiveDefault</span></tt>.</p>

    </div>
    </div>


    

            <a href="#top" class="totoc">back to section top</a>
    </div>



            
    

    
    
    <A name="docstrings_sqlalchemy.schema_PrimaryKeyConstraint"></a>
    
    <div class="sectionL3">

    <h3>class PrimaryKeyConstraint(<a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_Constraint">Constraint</a>)</h3>
    
    
    <div class="darkcell"><p>A table-level PRIMARY KEY constraint.</p>
<p>Defines a single column or composite PRIMARY KEY constraint. For a
no-frills primary key, adding <tt class="docutils literal"><span class="pre">primary_key=True</span></tt> to one or more
<tt class="docutils literal"><span class="pre">Column</span></tt> definitions is a shorthand equivalent for an unnamed single- or
multiple-column PrimaryKeyConstraint.</p>
</div>
    

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __init__(<i>self</i>, <i>*columns</i>, <i>**kwargs</i>)</b>
    <div class="docstring">
    <p>Construct a composite-capable PRIMARY KEY.</p>
<dl class="docutils">
<dt>*columns</dt>
<dd>A sequence of column names.  All columns named must be defined and
present within the parent Table.</dd>
<dt>name</dt>
<dd>Optional, the in-database name of the key.</dd>
<dt>deferrable</dt>
<dd>Optional bool.  If set, emit DEFERRABLE or NOT DEFERRABLE when
issuing DDL for this constraint.</dd>
<dt>initially</dt>
<dd>Optional string.  If set, emit INITIALLY &lt;value&gt; when issuing DDL
for this constraint.</dd>
</dl>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def add(<i>self</i>, <i>col</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def add(<i>self</i>, <i>col</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def copy(<i>self</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def remove(<i>self</i>, <i>col</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def replace(<i>self</i>, <i>col</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __eq__(<i>self</i>, <i>other</i>)</b>
    <div class="docstring">
    
    </div>
    </div>


    

            <a href="#top" class="totoc">back to section top</a>
    </div>



            
    

    
    
    <A name="docstrings_sqlalchemy.schema_SchemaItem"></a>
    
    <div class="sectionL3">

    <h3>class SchemaItem(object)</h3>
    
    
    <div class="darkcell"><p>Base class for items that define a database schema.</p>
</div>
    

                    
         <div class="darkcell">
         <A name=""></a>
         <b>bind = property()</b>
         <div class="docstring">
         <p>Return the connectable associated with this SchemaItem.</p>

         </div> 
         </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def get_children(<i>self</i>, <i>**kwargs</i>)</b>
    <div class="docstring">
    <p>used to allow SchemaVisitor access</p>

    </div>
    </div>

                    
         <div class="darkcell">
         <A name=""></a>
         <b>info = property()</b>
         <div class="docstring">
         
         </div> 
         </div>


    

            <a href="#top" class="totoc">back to section top</a>
    </div>



            
    

    
    
    <A name="docstrings_sqlalchemy.schema_SchemaVisitor"></a>
    
    <div class="sectionL3">

    <h3>class SchemaVisitor(ClauseVisitor)</h3>
    
    
    <div class="darkcell"><p>Define the visiting for <tt class="docutils literal"><span class="pre">SchemaItem</span></tt> objects.</p>
</div>
    


    

            <a href="#top" class="totoc">back to section top</a>
    </div>



            
    

    
    
    <A name="docstrings_sqlalchemy.schema_Sequence"></a>
    
    <div class="sectionL3">

    <h3>class Sequence(<a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_DefaultGenerator">DefaultGenerator</a>)</h3>
    
    
    <div class="darkcell"><p>Represents a named database sequence.</p>
</div>
    

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __init__(<i>self</i>, <i>name</i>, <i>start=None</i>, <i>increment=None</i>, <i>schema=None</i>, <i>optional=False</i>, <i>quote=False</i>, <i>**kwargs</i>)</b>
    <div class="docstring">
    <p>Construct a new <tt class="docutils literal"><span class="pre">Sequence</span></tt>.</p>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def create(<i>self</i>, <i>bind=None</i>, <i>checkfirst=True</i>)</b>
    <div class="docstring">
    <p>Creates this sequence in the database.</p>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def drop(<i>self</i>, <i>bind=None</i>, <i>checkfirst=True</i>)</b>
    <div class="docstring">
    <p>Drops this sequence from the database.</p>

    </div>
    </div>


    

            <a href="#top" class="totoc">back to section top</a>
    </div>



            
    

    
    
    <A name="docstrings_sqlalchemy.schema_Table"></a>
    
    <div class="sectionL3">

    <h3>class Table(<a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_SchemaItem">SchemaItem</a>,<a href="sqlalchemy_sql_expression.html#docstrings_sqlalchemy.sql.expression_TableClause">TableClause</a>)</h3>
    
    
    <div class="darkcell"><p>Represent a relational database table.</p>
</div>
    

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __init__(<i>self</i>, <i>name</i>, <i>metadata</i>, <i>*args</i>, <i>**kwargs</i>)</b>
    <div class="docstring">
    <p>Construct a Table.</p>
<p>Table objects can be constructed directly.  Arguments are:</p>
<dl class="docutils">
<dt>name</dt>
<dd><p class="first">The name of this table, exactly as it appears, or will appear, in
the database.</p>
<p>This property, along with the <em>schema</em>, indicates the <em>singleton
identity</em> of this table.</p>
<p class="last">Further tables constructed with the same name/schema combination
will return the same Table instance.</p>
</dd>
<dt>*args</dt>
<dd>Should contain a listing of the Column objects for this table.</dd>
<dt>**kwargs</dt>
<dd><p class="first">kwargs include:</p>
<dl class="last docutils">
<dt>schema</dt>
<dd>The <em>schema name</em> for this table, which is required if the table
resides in a schema other than the default selected schema for the
engine's database connection.  Defaults to <tt class="docutils literal"><span class="pre">None</span></tt>.</dd>
<dt>autoload</dt>
<dd>Defaults to False: the Columns for this table should be reflected
from the database.  Usually there will be no Column objects in the
constructor if this property is set.</dd>
<dt>autoload_with</dt>
<dd>if autoload==True, this is an optional Engine or Connection
instance to be used for the table reflection.  If <tt class="docutils literal"><span class="pre">None</span></tt>, the
underlying MetaData's bound connectable will be used.</dd>
<dt>include_columns</dt>
<dd>A list of strings indicating a subset of columns to be loaded via
the <tt class="docutils literal"><span class="pre">autoload</span></tt> operation; table columns who aren't present in
this list will not be represented on the resulting <tt class="docutils literal"><span class="pre">Table</span></tt>
object.  Defaults to <tt class="docutils literal"><span class="pre">None</span></tt> which indicates all columns should
be reflected.</dd>
<dt>info</dt>
<dd>Defaults to {}: A space to store application specific data; this
must be a dictionary.</dd>
<dt>mustexist</dt>
<dd>Defaults to False: indicates that this Table must already have
been defined elsewhere in the application, else an exception is
raised.</dd>
<dt>useexisting</dt>
<dd>Defaults to False: indicates that if this Table was already
defined elsewhere in the application, disregard the rest of the
constructor arguments.</dd>
<dt>owner</dt>
<dd>Deprecated; this is an oracle-only argument - &quot;schema&quot; should
be used in its place.</dd>
<dt>quote</dt>
<dd>When True, indicates that the Table identifier must be quoted.
This flag does <em>not</em> disable quoting; for case-insensitive names,
use an all lower case identifier.</dd>
<dt>quote_schema</dt>
<dd>When True, indicates that the schema identifier must be quoted.
This flag does <em>not</em> disable quoting; for case-insensitive names,
use an all lower case identifier.</dd>
</dl>
</dd>
</dl>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def append_column(<i>self</i>, <i>column</i>)</b>
    <div class="docstring">
    <p>Append a <tt class="docutils literal"><span class="pre">Column</span></tt> to this <tt class="docutils literal"><span class="pre">Table</span></tt>.</p>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def append_constraint(<i>self</i>, <i>constraint</i>)</b>
    <div class="docstring">
    <p>Append a <tt class="docutils literal"><span class="pre">Constraint</span></tt> to this <tt class="docutils literal"><span class="pre">Table</span></tt>.</p>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def append_ddl_listener(<i>self</i>, <i>event</i>, <i>listener</i>)</b>
    <div class="docstring">
    <p>Append a DDL event listener to this <tt class="docutils literal"><span class="pre">Table</span></tt>.</p>
<p>The <tt class="docutils literal"><span class="pre">listener</span></tt> callable will be triggered when this <tt class="docutils literal"><span class="pre">Table</span></tt> is
created or dropped, either directly before or after the DDL is issued
to the database.  The listener may modify the Table, but may not abort
the event itself.</p>
<p>Arguments are:</p>
<dl class="docutils">
<dt>event</dt>
<dd>One of <tt class="docutils literal"><span class="pre">Table.ddl_events</span></tt>; e.g. 'before-create', 'after-create',
'before-drop' or 'after-drop'.</dd>
<dt>listener</dt>
<dd><p class="first">A callable, invoked with three positional arguments:</p>
<dl class="last docutils">
<dt>event</dt>
<dd>The event currently being handled</dd>
<dt>schema_item</dt>
<dd>The <tt class="docutils literal"><span class="pre">Table</span></tt> object being created or dropped</dd>
<dt>bind</dt>
<dd>The <tt class="docutils literal"><span class="pre">Connection</span></tt> bueing used for DDL execution.</dd>
</dl>
</dd>
</dl>
<p>Listeners are added to the Table's <tt class="docutils literal"><span class="pre">ddl_listeners</span></tt> attribute.</p>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def create(<i>self</i>, <i>bind=None</i>, <i>checkfirst=False</i>)</b>
    <div class="docstring">
    <p>Issue a <tt class="docutils literal"><span class="pre">CREATE</span></tt> statement for this table.</p>
<p>See also <tt class="docutils literal"><span class="pre">metadata.create_all()</span></tt>.</p>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def drop(<i>self</i>, <i>bind=None</i>, <i>checkfirst=False</i>)</b>
    <div class="docstring">
    <p>Issue a <tt class="docutils literal"><span class="pre">DROP</span></tt> statement for this table.</p>
<p>See also <tt class="docutils literal"><span class="pre">metadata.drop_all()</span></tt>.</p>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def exists(<i>self</i>, <i>bind=None</i>)</b>
    <div class="docstring">
    <p>Return True if this table exists.</p>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def get_children(<i>self</i>, <i>column_collections=True</i>, <i>schema_visitor=False</i>, <i>**kwargs</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
         <div class="darkcell">
         <A name=""></a>
         <b>key = property()</b>
         <div class="docstring">
         
         </div> 
         </div>

                    
         <div class="darkcell">
         <A name=""></a>
         <b>primary_key = property()</b>
         <div class="docstring">
         
         </div> 
         </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def tometadata(<i>self</i>, <i>metadata</i>, <i>schema=None</i>)</b>
    <div class="docstring">
    <p>Return a copy of this <tt class="docutils literal"><span class="pre">Table</span></tt> associated with a different <tt class="docutils literal"><span class="pre">MetaData</span></tt>.</p>

    </div>
    </div>


    

            <a href="#top" class="totoc">back to section top</a>
    </div>



            
    

    
    
    <A name="docstrings_sqlalchemy.schema_ThreadLocalMetaData"></a>
    
    <div class="sectionL3">

    <h3>class ThreadLocalMetaData(<a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_MetaData">MetaData</a>)</h3>
    
    
    <div class="darkcell"><p>A MetaData variant that presents a different <tt class="docutils literal"><span class="pre">bind</span></tt> in every thread.</p>
<p>Makes the <tt class="docutils literal"><span class="pre">bind</span></tt> property of the MetaData a thread-local value, allowing
this collection of tables to be bound to different <tt class="docutils literal"><span class="pre">Engine</span></tt>
implementations or connections in each thread.</p>
<p>The ThreadLocalMetaData starts off bound to None in each thread.  Binds
must be made explicitly by assigning to the <tt class="docutils literal"><span class="pre">bind</span></tt> property or using
<tt class="docutils literal"><span class="pre">connect()</span></tt>.  You can also re-bind dynamically multiple times per
thread, just like a regular <tt class="docutils literal"><span class="pre">MetaData</span></tt>.</p>
<p>Use this type of MetaData when your tables are present in more than one
database and you need to address them simultanesouly.</p>
</div>
    

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __init__(<i>self</i>)</b>
    <div class="docstring">
    <p>Construct a ThreadLocalMetaData.</p>

    </div>
    </div>

                    
         <div class="darkcell">
         <A name=""></a>
         <b>bind = property()</b>
         <div class="docstring">
         <p>The bound Engine or Connection for this thread.</p>
<p>This property may be assigned an Engine or Connection, or assigned a
string or URL to automatically create a basic Engine for this bind
with <tt class="docutils literal"><span class="pre">create_engine()</span></tt>.</p>

         </div> 
         </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def connect(<i>*args</i>, <i>**kwargs</i>)</b>
    <div class="docstring">
    <p>Deprecated.
Bind to an Engine in the caller's thread.</p>
<blockquote>
<p>Use <tt class="docutils literal"><span class="pre">metadata.bind=&lt;engine&gt;</span></tt> or <tt class="docutils literal"><span class="pre">metadata.bind=&lt;url&gt;</span></tt>.</p>
<dl class="docutils">
<dt>bind</dt>
<dd>A string, <tt class="docutils literal"><span class="pre">URL</span></tt>, <tt class="docutils literal"><span class="pre">Engine</span></tt> or <tt class="docutils literal"><span class="pre">Connection</span></tt> instance.  If a
string or <tt class="docutils literal"><span class="pre">URL</span></tt>, will be passed to <tt class="docutils literal"><span class="pre">create_engine()</span></tt> along with
<tt class="docutils literal"><span class="pre">\**kwargs</span></tt> to produce the engine which to connect to.  Otherwise
connects directly to the given <tt class="docutils literal"><span class="pre">Engine</span></tt>.</dd>
</dl>
</blockquote>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def dispose(<i>self</i>)</b>
    <div class="docstring">
    <p>Dispose all bound engines, in all thread contexts.</p>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def is_bound(<i>self</i>)</b>
    <div class="docstring">
    <p>True if there is a bind for this thread.</p>

    </div>
    </div>


    

            <a href="#top" class="totoc">back to section top</a>
    </div>



            
    

    
    
    <A name="docstrings_sqlalchemy.schema_UniqueConstraint"></a>
    
    <div class="sectionL3">

    <h3>class UniqueConstraint(<a href="sqlalchemy_schema.html#docstrings_sqlalchemy.schema_Constraint">Constraint</a>)</h3>
    
    
    <div class="darkcell"><p>A table-level UNIQUE constraint.</p>
<p>Defines a single column or composite UNIQUE constraint. For a no-frills,
single column constraint, adding <tt class="docutils literal"><span class="pre">unique=True</span></tt> to the <tt class="docutils literal"><span class="pre">Column</span></tt>
definition is a shorthand equivalent for an unnamed, single column
UniqueConstraint.</p>
</div>
    

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def __init__(<i>self</i>, <i>*columns</i>, <i>**kwargs</i>)</b>
    <div class="docstring">
    <p>Construct a UNIQUE constraint.</p>
<dl class="docutils">
<dt>*columns</dt>
<dd>A sequence of column names.  All columns named must be defined and
present within the parent Table.</dd>
<dt>name</dt>
<dd>Optional, the in-database name of the key.</dd>
<dt>deferrable</dt>
<dd>Optional bool.  If set, emit DEFERRABLE or NOT DEFERRABLE when
issuing DDL for this constraint.</dd>
<dt>initially</dt>
<dd>Optional string.  If set, emit INITIALLY &lt;value&gt; when issuing DDL
for this constraint.</dd>
</dl>

    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def append_column(<i>self</i>, <i>col</i>)</b>
    <div class="docstring">
    
    </div>
    </div>

                    
    <div class="darkcell">
    
    <A name=""></a>
    <b>def copy(<i>self</i>)</b>
    <div class="docstring">
    
    </div>
    </div>


    

            <a href="#top" class="totoc">back to section top</a>
    </div>



    

    </div>





    <div class="bottomnav">
        
    <div class="prevnext">
            Up: <a href="docstrings.html">API Documentation</a>

               |   
            Previous: <a href="sqlalchemy_pool.html">module sqlalchemy.pool</a>

               |   
            Next: <a href="sqlalchemy_sql_compiler.html">module sqlalchemy.sql.compiler</a>
    </div>

    </div>








</body>
</html>






